﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;

namespace OA.Model.MyAttribute
{
    public class IdentityAttribute: ValidationAttribute
    {
        public override bool IsValid(object value)
        {
            if ((!Regex.IsMatch(value.ToString(), @"^(^\d{15}$|^\d{18}$|^\d{17}(\d|X|x))$", RegexOptions.IgnoreCase)))
            {
                return false;
            }
            return true;
        }
    }
}
